import celery

_global_task_name_list = []

__all__ = ['auto_register_celery_tasks']


def auto_register_celery_tasks():
    if celery.current_app.conf.task_routes is None:
        celery.current_app.conf.task_routes = dict()

    for task_name in _global_task_name_list:
        print(f'{__file__}:12  {celery.current_app} ,当前python解释器一共发现任务 {len(_global_task_name_list)} 个。 \n {_global_task_name_list}')
        celery.current_app.conf.task_routes.update({task_name: {'queue': task_name}})
